//
//  CTServer.h
//  Astro
//
//  Created by Cuongth on 12/1/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <CommonCrypto/CommonDigest.h> // Need to import for CC_MD5 access
#import "JSON.h"
#import "LuckyNumberContent.h"

#define Default_PartnerId @"3"
#define Default_Secret @"293c09440fcb9ad67c4385ae4807940b"
#define Default_RequestSource @"ios"	

#define API_SignUp @"http://api.cami.vn/index.php/user/register?hash=%@&partner_id=%@&username=%@&password=%@&fullname=%@&birthday=%@&gender=%@&phone=%@&requestsource=%@"
#define API_GetUser @"http://api.cami.vn/index.php/user/getuser?hash=%@&partner_id=%@&username=%@"
#define API_Login @"http://api.cami.vn/index.php/user/login?hash=%@&partner_id=%@&username=%@&password=%@"

#define API_LuckyNumber @"http://api.cami.vn/index.php/user/luckyNumber?hash=%@&partner_id=%@&userid=%d&cunguser=%d"
#define API_Daily @"http://api.cami.vn/index.php/user/daily?hash=%@&partner_id=%@&userid=%d&cunguser=%d"

#define API_GoodBadDay @"http://api.cami.vn/index.php/user/goodBadDay?hash=%@&partner_id=%@&userid=%d&fromdate=%d&todate=%d&type=%@&ifree=%d"
#define API_CompareTwoAges @"http://api.cami.vn/index.php/user/comparison2age?hash=%@&partner_id=%@&userid=%d&comparisonage=%d&ifree=%d"
#define API_Commentary @"http://api.cami.vn/index.php/user/commentary?hash=%@&partner_id=%@&userid=%d$requesttype=%d&requestsubtype=%d&requesttime=%d&ifree=%d"

@interface CTServer : NSObject {
	
}

+ (NSInteger) requestURLSignUpWithUserName:(NSString*)userName 
								  password:(NSString*)password 								  
								  birthday:(NSString*)birthday 
									gender:(NSString*)gender
								  andPhone:(NSString*)phone;

+ (SOUser*) requestURLGetUserWithUserName:(NSString*)userName;

+ (LuckyNumberContent*) requestURLGetLuckyNumberInfo:(NSInteger)userId withCungUser:(NSInteger)cungUser;
+ (NSString*) requestURLGetDailyInfo:(NSInteger)userId withCungUser:(NSInteger)cungUser;

+ (BOOL) requestURLSignInWithUserName:(NSString*)userName
							   andPassword:(NSString*)password;

+ (NSString*) requestURLGetGoodBadDay:(int)startDate toDate:(int)endDate withType:(NSString*)type andUserId:(int)userId andIsFree:(int)isFree;							 
+ (NSString*) requestURLGetCompareTwoAges:(int)startDate toDate:(int)endDate withType:(NSString*)type andUserId:(int)userId andIsFree:(int)isFree;							 
+ (NSString*) requestURLGetCommentary:(int)userId withRequestType:(int)type andSubtype:(int)subType andTime:(int)timeRequest andIsFree:(int)isFree;							 


@end


@interface NSString (MD5Extensions)
- (NSString *) md5;
@end

@interface NSData (MD5Extensions)
- (NSString*)md5;
@end
